Conditions | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { AxiosRequestConfig } from 'axios'; |
||
37 | |||
38 | /** |
||
39 | * Set Authorization header if not already set and access token is present. |
||
40 | * |
||
41 | * @param config The axios request config |
||
42 | */ |
||
43 | protected async setAuthorizationHeader(config: AxiosRequestConfig): Promise<AxiosRequestConfig> { |
||
44 | const accessToken = await this.beditaClient.getStorageService().getAccessToken(); |
||
45 | if (accessToken && !config.headers?.Authorization) { |
||
46 | config.headers.Authorization = `Bearer ${accessToken}`; |
||
47 | } |
||
48 | |||
49 | return config; |
||
50 | } |
||
52 |